@extends('admin.layouts.app')
@section('css')
    <link href="{{asset('assets/plugins/select2/css/select2.min.css')}}" rel="stylesheet" type="text/css" />
 
@endsection
@section('content')


                        <!-- Page-Title -->
                        <div class="row">
                            <div class="col-sm-12">
                                <div class="btn-group pull-right m-t-15">
                                    <button type="button" class="btn btn-default dropdown-toggle waves-effect waves-light" data-toggle="dropdown" aria-expanded="false">Settings <span class="m-l-5"><i class="fa fa-cog"></i></span></button>
                                    <ul class="dropdown-menu drop-menu-right" role="menu">
                                        <li><a href="#">Action</a></li>
                                        <li><a href="#">Another action</a></li>
                                        <li><a href="#">Something else here</a></li>
                                        <li class="divider"></li>
                                        <li><a href="#">Separated link</a></li>
                                    </ul>
                                </div>

                                <h4 class="page-title">Responsive Table</h4>
                                <ol class="breadcrumb">
                                    <li>
                                        <a href="#">Ubold</a>
                                    </li>
                                    <li>
                                        <a href="#">Tables</a>
                                    </li>
                                    <li class="active">
                                        Responsive Table
                                    </li>
                                </ol>
                            </div>
                        </div>
                        

                        
                        <div class="row">
                            <div class="col-sm-12">
                                <div class="card-box">
                                            
        <form class="form-inline">
            <div class="form-group m-r-10">
            <label for="exampleInputName2">手机号</label>
                <input type="text" class="form-control" name="phone" placeholder="" value="{{array_get($where,'phone')}}">
            </div>
            <div class="form-group m-r-10">
            <label for="exampleInputEmail2">店铺</label>
            <select class="form-control" name="shop_id">
                <option value="">请选择品类</option>
                @foreach($shops as $k=>$shop)
                <option value="{{$shop->id}}" {{array_get($where,'shop_id')==$shop->id?'selected':''}}>{{$shop->name}}</option>
                @endforeach
                
            </select>
            </div>
           
                                                <button type="submit" class="btn btn-default waves-effect waves-light btn-md">
                                                    搜索
                                                </button>

                                                <button type="button" class="btn btn-primary waves-effect waves-light btn-add">
                                                    添加
                                                </button>
                                            </form>
                            </div>              
                         </div>

                            <div class="col-sm-12">
                                <div class="card-box">


                                    
        <div class="table-rep-plugin">
            <div class="table-responsive" >
                <table  class="table  table-striped">
                    <thead>
                        <tr>
                            <th>ID</th>
                            <th data-priority="1">姓名</th>
                            <th data-priority="1">电话</th>
                            <th data-priority="3">角色</th>
                           
                            <th data-priority="3">状态</th>
                            <th>所属店铺</th>
                                               
                            <th data-priority="6">操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach($list as $v)  
                        <tr>
                            <th>{{$v->id}}</th>
                            <th>{{$v->name or ''}}</th>
                            <td>{{$v->phone}}</td>
                            <td>{{$v->role_txt}}</td>
                            <td>{{$v->status_txt}}</td>
                            <td>{{$v->shop->name or ''}}</td>
                            <th>
                               <a class="btn btn-sm btn-danger" href="{{url('zadmin/shop/user',$v->id)}}" data-method="delete" 
  data-token="{{csrf_token()}}" data-confirm="确定删除吗?">
<span class="btn-label">
  <i class="md md-close"></i>
</span>删除</a>
                            </th>
                            
                        </tr>
                        @endforeach
                                                    
                                                </tbody>
                                            </table>
                                        </div>
{{$list->appends($where)->links()}}
                                    </div>

                                </div>
                            </div>
                        </div>



<div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
          &times;
        </button>
        <h4 class="modal-title" id="myModalLabel">
          操作
        </h4>
      </div>
       <form method="post" action="{{url('zadmin/shop/user')}}" >
      <div class="modal-body">
        <div class="row">
            <div class="form-group">
                <label class="col-md-4 control-label">姓名</label>
                <div class="col-md-8">
                  <input class="form-control"  name="name" placeholder=""/>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-4 control-label">电话</label>
                <div class="col-md-8">
                  <input class="form-control"  name="phone" placeholder="">
                </div>
            </div> 
            <div class="form-group">
                <label class="col-md-4 control-label">验证码</label>
                <div class="col-md-8">
                  <input class="form-control"  name="code" placeholder="第一次登陆时使用">
                </div>
            </div> 
            <div class="form-group">
                <label class="col-md-4 control-label">角色</label>
                <div class="col-md-8">
                  <select class="form-control" name="role_id">
                    @foreach($roles as $k=>$role)
                      <option value="{{$k}}">{{$role}}</option>
                    @endforeach  
                  </select>
                </div>
            </div>
        </div>   
        <input name="shop_id" value="{{array_get($where,'shop_id')}}">
       {{csrf_field()}}
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">关闭
        </button>
        <button type="submit" class="btn btn-primary">
          确定
        </button>
      </div>
    </form>
    </div><!-- /.modal-content -->
  </div><!-- /.modal -->
</div>
 @endsection 
               
         

    @section('js')
        <script src="{{asset('assets/plugins/select2/js/select2.min.js')}}" type="text/javascript"></script>

      <script type="text/javascript">
        var product_id = '';
        var status = '';
        $('.btn-add').on('click',function(){
           
            $('#addModal').modal('show');
        });
      </script>
    @endsection    

